//toggle事件
$.fn.toggle = function(fn, fn2) {
	var args = arguments,
		guid = fn.guid || $.guid++,
		i = 0,
		toggle = function(event) {
			var lastToggle = ($._data(this, "lastToggle" + fn.guid) || 0) % i;
			$._data(this, "lastToggle" + fn.guid, lastToggle + 1);
			event.preventDefault();
			return args[lastToggle].apply(this, arguments) || false;
		};
	toggle.guid = guid;
	while(i < args.length) {
		args[i++].guid = guid;
	}
	return this.click(toggle);
};
(function(doc, win) {
	var docEl = doc.documentElement,
		resizeEvt = 'onorientationchange' in window ? 'onorientationchange' : 'resize',
		recalc = function() {
			var clientWidth = docEl.clientWidth;
			if(!clientWidth) return;
			if(clientWidth >= 750) {
				docEl.style.fontSize = '100px';
			} else {
				docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
			}
		};

	if(!doc.addEventListener) return;
	win.addEventListener(resizeEvt, recalc, false);
	doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
//全面屏
var h = $(window).height();
var w = $(window).width();
var ratio = h / w;
if(ratio > 1.8) {
	$(".logo").addClass("logo_big");
	$(".login_style").addClass("login_style_big");
	$(".login").addClass("login_big");
}
//select字体颜色
$("select").css("color", "#CCCCCC");
$("select").change(function() {
	var selItem = $(this).val();
	if(selItem == $(this).find('option:first').val()) {
		$(this).css("color", "#CCCCCC");
	} else {
		$(this).css("color", "#000000");
	}
});
//登录
//边框颜色
$(".Mlogin input").focus(function() {
	$(this).css("border", "1px solid #FF595A");
})
$(".Mlogin input").blur(function() {
	$(this).css("border", "1px solid #D9D9D9");
})
var flag1 = false;
var flag2 = false;

function l_submit() {
	if(flag1 && flag2) {
		$(".login .sub").removeAttr("disabled");
		$(".login .sub").css("background-color", "#FF595A");
		return;
	} else {
		$(".login .sub").attr("disabled", "true");
		$(".login .sub").css("background-color", "#DEDEDE");
	}
}
//验证账号
$(".login .user input").blur(function() {
	var userName = $.trim($(".login .user input").val());
	var reg = /^1\d{10}$/;
	var reg1 = /[a-zA-Z0-9]{1,10}@[a-zA-Z0-9]{1,5}\.[a-zA-Z0-9]{1,5}/;
	var reg2 = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,8}$/;
	if(!reg.test(userName) && !reg1.test(userName) && !reg2.test(userName)) {
		flag1 = false;
	} else {
		flag1 = true;
	}
	l_submit()
});
//验证密码
$(".login .paw input").blur(function() {
	var userPaw = $.trim($(this).val());
	var reg = /[0-9A-Za-z]{6,}$/;
	if(!reg.test(userPaw) && !userPaw.length < 6) {
		flag2 = false;
	} else {
		flag2 = true;
	}
	l_submit()
})
//禁止非法输入
$(".login .user input").keyup(function() {
	$(this).val($(this).val().replace(/[^\w\.\@\_\-/]/g, ''));
})
$(".login .paw input").keyup(function() {
	$(this).val($(this).val().replace(/[^\w]/g, ''));
})
//手机、邮箱注册
var flag = [false, false, false, false, false, false];

function m_submit() {
	for(var i in flag) {
		if(!flag[i]) {
			$(".submit").css("background-color", "#DEDEDE");
			$(".submit").attr("disabled", "true");
			return;
		}
	}
	$(".submit").css("background-color", "#FF595A");
	$(".submit").removeAttr("disabled");
}
$(".m_phone .no_val").on("blur", function() {
	var re = /^1\d{10}$/;
	var str = $(this).val();
	if(re.test(str)) {
		flag[0] = true;
		$(".btn").css("background-color", "#FF595A");
		$('.btn').removeAttr('disabled');
	} else {
		flag[0] = false;
		$(".btn").css("background-color", "#DEDEDE");
		$('.btn').attr('disabled', "true");
	}
	m_submit();
});
$(".m_email .no_val").on("blur", function() {
	var re = /[a-zA-Z0-9]{1,10}@[a-zA-Z0-9]{1,5}\.[a-zA-Z0-9]{1,5}/;
	var str = $(this).val();
	if(re.test(str)) {
		flag[0] = true;
		$(".btn").css("background-color", "#FF595A");
		$('.btn').removeAttr('disabled');
	} else {
		flag[0] = false;
		$(".btn").css("background-color", "#DEDEDE");
		$('.btn').attr('disabled', "true");
	}
	m_submit();
});
$(".email .no_val").on("blur", function() {
	var re = /^1\d{10}$/;
	var str = $(this).val();
	if(re.test(str)) {
		flag[0] = true;
		$(".btn").css("background-color", "#FF595A");
		$('.btn').removeAttr('disabled');
	} else {
		flag[0] = false;
		$(".btn").css("background-color", "#DEDEDE");
		$('.btn').attr('disabled', "true");
	}
	m_submit();
});
$(".Mlogin .m_code").blur(function() {
	var str = $(this).val();
	if(str.length <= 0) {
		flag[1] = false;
	} else {
		flag[1] = true;
	}
	m_submit();
});
$(".Mlogin .put_code").blur(function() {
	var str = $(this).val();
	if(str.length <= 0) {
		flag[2] = false;
	} else {
		flag[2] = true;
	}
	m_submit();
});
$(".Mlogin .paw_val").blur(function() {
	var str = $(this).val();
	var re = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/;
	if(re.test(str)) {
		flag[3] = true;
	} else {
		flag[3] = false;
	}
	m_submit();
});
$(".Mlogin .paw_val2").blur(function() {
	if($(".paw_val").val() == $(".paw_val2").val()) {
		flag[4] = true;
	} else {
		flag[4] = false;
	}
	m_submit();
});
$(".protocol input").click(function() {
	if($(this).prop('checked')) {
		flag[5] = true;
	} else {
		flag[5] = false;
	}
	m_submit();
})
//禁止非法输入
$(".paw1").keyup(function() {
	$(this).val($(this).val().replace(/[^\w]/g, ''));
});
$(".m_phone .no_val").keyup(function() {
	$(this).val($(this).val().replace(/[^1\d]/g, ''));
});
$(".m_email .no_val").keyup(function() {
	$(this).val($(this).val().replace(/[^\w\.\@\_\-/]/g, ''));
});

function getMCode() {
	var time = '';
	var i = 60;
	time = setInterval(function() {
		i--;
		if(i > 0) {
			$(".btn").html('重新发送(' + i + ')');
			$(".btn").attr('disabled', "true");
			$(".btn").css("background-color", "#DEDEDE");
		} else {
			clearInterval(time);
			$(".btn").html('发送验证码');
			$('.btn').removeAttr('disabled');
			$(".btn").css("background-color", "#FF595A");
		}
	}, 1000)
}
//选择性别
$(".sel_sex").click(function() {
	var picker = new mui.PopPicker();
	picker.setData([{
		value: '0',
		text: '男'
	}, {
		value: '1',
		text: '女'
	}, {
		value: '2',
		text: '保密'
	}]);
	picker.show(function(selectItems) {
		$(".sel_sex").val(selectItems[0].text)
	})
})
//我的包裹页面
$(".sel_pack input").on("input", function() {
	if($(".sel_pack input").val() != "") {
		$(".sel_pack span").hide();
	} else {
		$(".sel_pack span").show();
	}
})
$(".rec_pack2 input").on("input", function() {
	if($(".rec_pack2 input").val() != "") {
		$(".rec_pack2 span").hide();
	} else {
		$(".rec_pack2 span").show();
	}
})
//礼品卡数量
var num = 1;
$('.minus_jian').on("click", function() {
	num = $(this).parent().find('.card_number').html();
	console.log(num)
	num--;
	if(num <= 1) {
		num = 1;
	}
	$(this).parent().find('.card_number').html(num);
})
$('.add_jia').click(function() {
	num = $(this).parent().find('.card_number').html();
	num++;
	$(this).parent().find('.card_number').html(num);
})
//添加物品页出现
$(".add_pre_write .add_goods").click(function() {
	$("#add_goods").show();
	$(".fill_btn_add").css("background-color", "#DEDEDE");
	$(".fill_btn_add").attr("disabled", "true");
	btnDisabled();
	$(".fill_btn_add2").hide();
	$("#add_goods input").val("");
	$("#add_goods select").val(0);
	$("#add_goods select").val(0).css("color", "#CCCCCC");
});
$(".fill_btn_close").click(function() {
	$("#add_goods").hide();
});

function goodCatory1() {
	//商品分类接口调用
	$.ajax({
		type: "get",
		url: "/h5/ajax_get_category?leaf=2",
		async: true,
		success: function(data) {
			for(var i = 0; i < data.length; i++) {
				var str = '<option value=' + data[i].id + '>' + data[i].name + '</option>';
				$("#bigType").append(str);
			}
		}
	});
	$("#bigType").on("change", function() {
		$("#smallType").html('<option value="0">请选择</option>');
		$.ajax({
			type: "get",
			url: "/h5/ajax_get_category_by_parentid",
			async: true,
			data: {
				"parentId": $("#bigType option:selected").val()
			},
			success: function(data) {
				for(var i = 0; i < data.length; i++) {
					var str = '<option value=' + data[i].id + '>' + data[i].name + '</option>';
					$("#smallType").append(str);
				}
			}
		});
	})
}
//判断添加物品按钮是否可点击
var flag4 = [false, false, false, false, false];

function btnDisabled() {
	for(var i in flag4) {
		if(!flag4[i]) {
			$(".fill_btn_add").css("background-color", "#DEDEDE");
			$(".fill_btn_add").attr("disabled", "true");
			$(".fill_btn_add2").css("background-color", "#DEDEDE");
			$(".fill_btn_add2").attr("disabled", "true");
			return;
		}
	}
	$(".fill_btn_add").css("background-color", "#FF595A");
	$(".fill_btn_add").removeAttr("disabled");
	$(".fill_btn_add2").css("background-color", "#FF595A");
	$(".fill_btn_add2").removeAttr("disabled");
}
$(".inP").each(function(i) {
	$(".inP").eq(i).keyup(function() {
		if($(this).val() != "") {
			flag4[i] = true;
		} else {
			flag4[i] = false;
		}
		btnDisabled();
	})
})
$(".inS").each(function(i) {
	$(".inS").eq(i).change(function() {
		if($(this).val() != "0") {
			flag4[i + 3] = true;
		} else {
			flag4[i + 3] = false;
		}
		btnDisabled();
	})
});

function slideLi() {
	//左右滑动
	$(".pre_write_list_li").each(function() {
		$(this).swipe({
			swipeLeft: function(event, direction, distance, duration, fingerCount) {

				$(this).children().children(".pre_write_next").show();
				$(this).children().children(".pre_write_goods").css("margin-left", "-1rem");
				$(this).children().children(".pre_write_goods").css("transition", "0.5s");
			},
			swipeRight: function(event, direction, distance, duration, fingerCount) {
				$(this).children().children(".pre_write_next").hide();
				$(this).children().children(".pre_write_goods").css("margin-left", "0");
			}
		});
	});
	//删除商品
	$(".pre_write_next").on("click", function() {
		$(this).parent().parent().remove()
	})
}
//提示框
$("body").on("click", ".beizhu", function() {
	$(".meng").show();
	$(".package_tips_box").show();
});
$("body").on("click", ".package_tips_btn", function() {
	$(".meng").hide();
	$(".package_tips_box").hide();
	$(".package_tips_rule").hide();
});
//上传图片
$('#updateImg').change(function() {
	$("#img").ajaxSubmit({
		type: 'post',
		url: "${request.contextPath}/h5/user/upload_mobile_img.do",
		success: function(data) {
			var res = JSON.parse(data);
			if(res.code == 0) {
				var txt = res.data;
				var div = document.createElement("div");
				var div1 = document.createElement("div");
				var img1 = document.createElement("img");
				var img2 = document.createElement("img");
				var img3 = document.createElement("img");
				var img4 = document.createElement("img");
				img2.src = "img/delet.png";
				img4.src = "img/delet.png"
				div1.appendChild(img3);
				div1.appendChild(img4);
				div.appendChild(img1);
				div.appendChild(img2);
				img1.src = txt;
				img3.src = txt;
				div.setAttribute("class", "pre_write_upload_img1");
				div1.setAttribute("class", "pre_write_upload_img2");
				img2.setAttribute("class", "img_del");
				img1.setAttribute("class", "img_add");
				img4.setAttribute("class", "img_del");
				img3.setAttribute("class", "img_add");
				$(".pre_write_upload_b").before(div);
				$(".upload_b").before(div1);
				$(".pre_write_upload_img1").each(function() {
					$(this).find(".img_del").click(function() {
						$(this).parent().remove();
					})
				})
				$(".pre_write_upload_img2").each(function() {
					$(this).find(".img_del").click(function() {
						$(this).parent().remove();
					})
				})
			}
		}
	});
});
//默认地址
function addressFirst() {
	$.ajax({
		type: "post",
		url: "/h5/getUserMessage",
		async: true,
		success: function(data) {
			var res = JSON.parse(data);
			console.log(res)
			var id = res.data.defaultAddressId;
			if(res.code == 0) {
				$.ajax({
					type: "get",
					url: "/h5/getAddressById",
					async: true,
					data: {
						"id": id
					},
					success: function(data) {
						var res = JSON.parse(data);
						if(res.data==undefined){
							$(".pre_write_info2").hide();
							$(".pre_write_info1 span").eq(2).hide();
						}else{
						console.log(res.data)
						var str = res.data.address;
						str = str.replace(/\>/g, ' ');
						var phone = res.data.consigneePhone;
						phone = phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
						var idcard = res.data.idCard;
						idcard = idcard.replace(/^(.{6})(?:\d+)(.{4})$/, "$1********$2");
						$(".pre_write_info1 span").eq(0).html(res.data.consignee);
						$(".pre_write_info1 span").eq(1).html(phone);
						$(".pre_write_info1 span").eq(2).html(res.data.alias);
						$(".pre_write_num").html(idcard);
						$(".pre_write_address").html(str + res.data.addressDetails);
						$(".pre_write").attr("addressid", id);
						$(".pre_write_info2").show();
						$(".pre_write_info1 span").eq(2).show();
						}
					}
				});
			}
		}
	});
}
//获取渠道
var channelId;
$.ajax({
	type: "get",
	url: "/h5/ajax_get_channel",
	async: false,
	success: function(data) {
		for(var i = 0; i < data.length; i++) {
			var channelHtml = '<li class="channel_title" cId=' + data[i].id + '>' + data[i].name + '</li>';
			$('.channel_box').append(channelHtml);
			if(data[i].isDefault) {
				$(".fa_ch1 span").html(data[i].name);
				$(".fa_ch1").attr("chanelid", data[i].id);
				channelId = data[i].id;
			} else {
				channelId = $(".fa_ch1").attr("chanelid");
			}
		}
	}
});
$(document).on("click", ".channel_box .channel_title", function() {
	channelId = $(this).attr("cId");
});
//检查商品是否符合打包规则
var totalMoney = 0;
var wheightPack = 0;
var isPack = false;
var sum2 = 0;
var sum1 = 0;

function checkPack() {
	var listGoods = [];
	var jsProduct = [];

	$(".pre_table table .tr").each(function(i) {
		var arry = {};
		b = $(this).find(".pre_num").html();
		f = $(this).find(".pre_price").html();
		g = $(this).attr("trId");
		arry["categoryId"] = g;
		arry["amount"] = b;
		arry["declarePrice"] = f;
		jsProduct.push(arry);
	});
	jsProduct = JSON.stringify(jsProduct);
	listGoods = {
		"channelId": channelId,
		"jsProduct": jsProduct
	}
	console.log(listGoods)
	if(channelId != "" && jsProduct != "[]") {
		$.ajax({
			type: "post",
			url: "/h5/check_package_by_channel.do",
			async: true,
			data: listGoods,
			success: function(data) {
				var res = JSON.parse(data);
				console.log(res);
				if(res.code == 0) {
					isPack = true;
					$("#weight").html(res.data.weigh + "kg");
					$("#money3").html(res.data.wayFee + "元");
					totalMoney = res.data.wayFee;
					wheightPack = res.data.weigh;
					var mum = Number($("#money1").html().replace("元", ""));
					console.log(mum)
					$("#total2").html(mum + totalMoney + "元");
					$("#money2").html(mum + totalMoney + "元");
				} else {
					isPack = false;
					$(".tips").show();
					$(".tips").html(res.err);
					setTimeout(function() {
						$(".tips").hide();
					}, 2000);
				}
			}
		});
	}
}
//修改商品信息
$(".pre_table").on("click", " tbody .tr .pre_detial", function() {
	flag4 = [true, true, true, true, true];
	btnDisabled();
	var asd = $(this).parent();
	$("#add_goods").show();
	$(".fill_btn_add2").show();
	$("#bigType option:selected").html($(asd).find(".pre_bId").html());
	$("#smallType option:selected").html($(asd).find(".pre_sId").html());
	$("#smallType").css("color", "#000000");
	$("#bigType").css("color", "#000000");
	$("#cName").val($(asd).find(".pre_name").html());
	$("#sku").val($(asd).find(".pre_num").html());
	$("#danwei").val($(asd).find(".pre_danwei").html());
	$("#brand").val($(asd).find(".pre_brand").html());
	$("#guige").val($(asd).find(".pre_guige").html());
	$("#prices").val($(asd).find(".pre_price").html());
	$(".fill_btn_add2").on("click", function() {
		$("#add_goods").hide();
		$(asd).find(".pre_name").html($("#cName").val());
		$(asd).find(".pre_num").html($("#sku").val());
		$(asd).find(".pre_danwei").html($("#danwei").val());
		$(asd).find(".pre_brand").html($("#brand").val());
		$(asd).find(".pre_guige").html($("#guige").val());
		$(asd).find(".pre_price").html($("#prices").val());
		$(asd).find(".pre_sId").html($("#smallType option:selected").html());
		$(asd).find(".pre_bId").html($("#bigType option:selected").html());
		$(asd).attr("trId", $("#smallType option:selected").val())
		$(".fill_btn_add2").off("click");
		checkPack();
	})
});
//删除商品
$(".pre_table").on("click", " tbody .tr .pre_del", function() {
	$(this).parent().remove();
	console.log($(".tr").length);
	if($(".tr").length == 0) {
		$("#weight").html("0kg");
		$("#money3").html("0元");
		totalMoney = 0;
		wheightPack = 0;
		$("#total2").html("0元");
		$("#money2").html("0元");
		isPack = false;
	}
})
//时间戳
function timestampToTime(timestamp) {
	var date = new Date(timestamp); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
	Y = date.getFullYear() + '-';
	M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
	D = date.getDate() + ' ';
	h = date.getHours() + ':';
	m = date.getMinutes() + ':';
	s = date.getSeconds();
	return Y + M + D + h + m + s;
}

function timestampToTime2(timestamp) {
	var date = new Date(timestamp); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
	Y = date.getFullYear() + '-';
	M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
	D = date.getDate() + ' ';
	return Y + M + D;
}
//获取分类名
var sname, bname;

function categoryName() {
	$(".tr").each(function(i) {
		var sid = $(this).attr('trId');
		var small = $(this).find(".pre_sId");
		var big = $(this).find(".pre_bId");
		$.ajax({
			type: "get",
			url: "/h5/ajax_get_category_by_parentid",
			async: true,
			success: function(data) {
				for(var i = 0; i < data.length; i++) {
					if(sid == data[i].id) {
						sname = data[i].name;
						small.html(sname);
						var bid = data[i].parentId;
						$.ajax({
							type: "get",
							url: "/h5/ajax_get_category?leaf=2",
							async: true,
							success: function(data) {
								for(var i = 0; i < data.length; i++) {
									if(bid == data[i].id) {
										bname = data[i].name;
										big.html(bname);
									}
								}
							}
						});
					}
				}
			}
		});
	})
}
//某个预报包裹信息
var packmoney1 = 0,
	packmoney2 = 0,
	Fmoney=0;
function packageInfo() {
	$.ajax({
		type: "get",
		url: "/h5/ajax_get_putpackage_byid",
		async: true,
		data: {
			"id": ishave
		},
		success: function(data) {
			var res = JSON.parse(data);
			var imgSrc;
			var isImg = false;
			console.log(res)
			if(res.data.shopReceipt != "") {
				imgSrc = JSON.parse(res.data.shopReceipt);
				isImg = true;
			}
			var jsonGoods = JSON.parse(res.data.jsonProduct);
			var ServeId = res.data.addedServiceId.split(",");
			if(res.code == 0) {
				if(res.data.packageType == 1) {
					console.log(JSON.parse(res.data.jsonChannel));
					$(".fa_title").html(JSON.parse(res.data.jsonChannel).name);
					$(".fa_ch1").attr("chanelid", JSON.parse(res.data.jsonChannel).id);
				}
				for(var i = 0; i < jsonGoods.length; i++) {
					var strhF = '<tr class="tr" trId=' + jsonGoods[i].categoryId + '>' +
						'<td class="pre_brand">' + jsonGoods[i].brand + '</td>' +
						'<td class="pre_name">' + jsonGoods[i].name + '</td>' +
						'<td class="pre_num">' + jsonGoods[i].amount + '</td>' +
						'<td class="pre_detial">查看</td>' +
						'<td class="pre_del">删除</td>' +
						'<td class="pre_bId" style="display: none;"></td>' +
						'<td class="pre_sId" style="display: none;"></td>' +
						'<td class="pre_danwei" style="display: none;">' + jsonGoods[i].unit + '</td>' +
						'<td class="pre_guige" style="display: none;">' + jsonGoods[i].specification + '</td>' +
						'<td class="pre_price" style="display: none;">' + jsonGoods[i].declarePrice + '</td>' +
						'</tr>';
					if(res.data.packageType == 3) {
						if(jsonGoods[i].serialNumber == 1) {
							var tbody1 = $("#package .pre_listF").eq(0).children(".pre_table").children().children("tbody");
							tbody1.append(strhF);
						} else if(jsonGoods[i].serialNumber == 2) {
							var tbody2 = $("#package .pre_listF").eq(1).children(".pre_table").children().children("tbody");
							tbody2.append(strhF);
						}
					} else if(res.data.packageType == 2) {
						var tbody3 = $("#package .pre_listH").children(".pre_table").children().children("tbody");
						tbody3.append(strhF);
					} else if(res.data.packageType == 1) {
						var tbody4 = $(".pre_list").children(".pre_table").children().children("tbody");
						tbody4.append(strhF);
					}
				}
				if(isImg) {
					for(var i = 0; i < imgSrc.length; i++) {
						var srcHtml = '<div class="pre_write_upload_img1">' +
							'<img src=' + imgSrc[i] + ' class="img_add">' +
							'<img src="img/delet.png" class="img_del">' +
							'</div>';
						$(".pre_write_upload_b").before(srcHtml);
						$(".pre_write_upload_img1").each(function() {
							$(this).find(".img_del").click(function() {
								$(this).parent().remove();
							})
						})
					}
				}
				$("#pre_server li").each(function(i) {
					for(var i = 0; i < ServeId.length; i++) {
						if($(this).attr("serverid") == ServeId[i]) {
							$(this).children(".sever_check").addClass("checked");
							$(this).children(".sever_check").children().attr("src", "img/sever_sel.png");
							if($(this).find(".sever_state").children("div").html() == "免费") {
								$(this).find(".sever_state").children("img").attr("src", "img/sever-icon2.png");
							} else {
								$(this).find(".sever_state").children("img").attr("src", "img/sever-icon3.png");
							}
						}
					}
					if($(this).attr("serverid")==4){
						Fmoney=$(this).children(".chargeMoney").html().split("元").join("");
					}
				})
				sum1 = res.data.addedFee;
				sum2 = parseFloat(res.data.estimateMoney);
				if(res.data.addedTimes != 0) {
					$(".card_num").css("display", "flex");
					$(".card_number").html(res.data.addedTimes);
					num = res.data.addedTimes;
				}
				$("#weight").html(res.data.budgetWeigh + "kg");
				$("#money3").html(res.data.wayFee + "元");
				$("#money1").html(res.data.addedFee + "元");
				$("#money2").html(res.data.estimateMoney + "元");
				$("#total1").html(res.data.estimateMoney + "元");
				$("#total2").html(res.data.estimateMoney + "元");
				console.log(packmoney1)
				sum1 = res.data.addedFee;
				sum2 = res.data.addedFee;
				totalMoney = res.data.wayFee;
				wheightPack = res.data.budgetWeigh;
				$(".card_num img").click(function() {
					packmoney1 = res.data.addedFee;
					packmoney2 = res.data.estimateMoney;
					packmoney1 = add(packmoney1, mul(num - res.data.addedTimes, parseFloat(Fmoney)));
					packmoney2 = add(packmoney2, mul(num - res.data.addedTimes, parseFloat(Fmoney)));
					$("#money1").html(packmoney1 + "元");
					$("#money2").html(packmoney2 + "元");
					$("#total1").html(packmoney2 + "元");
					$("#total2").html(packmoney2 + "元");
					sum1 = packmoney1;
					sum2 = packmoney1;
					totalMoney = res.data.wayFee;
					wheightPack = res.data.budgetWeigh;
				})
			}
			categoryName();
		}
	});
}